# $Id: PKGBUILD 89037 2013-04-26 02:37:21Z angvp $
# Maintainer: Angel Velasquez <angvp@archlinux.org> 
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
# Contributor: Mario Danic <mario.danic@gmail.com>

pkgbase=python-paramiko
pkgname=python2-paramiko
pkgver=1.10.1
pkgrel=1
pkgdesc="Python module that implements the SSH2 protocol"
url="https://github.com/paramiko/paramiko/"
license=('LGPL')
arch=('any')
depends=('python2-crypto')
source=(http://pypi.python.org/packages/source/p/paramiko/paramiko-$pkgver.tar.gz)
md5sums=('4ba105e2d8535496fd633889396b20b7')

package_python2-paramiko() {
  cd "$srcdir/paramiko-$pkgver"

  python2 setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 README "$pkgdir/usr/share/doc/$pkgname/README"
  install -dm755 "$pkgdir/usr/share/doc/$pkgname/demos"
  install -m644 demos/* "$pkgdir/usr/share/doc/$pkgname/demos"
  chmod 755 "$pkgdir/usr/share/doc/$pkgname/demos/"*.py

  find "$pkgdir" -name '*.py' -print0 |xargs -0 \
    sed -i -e 's,^#!/usr/bin/env python$,#!/usr/bin/env python2,' \
    -e 's,^#!/usr/bin/python$,#!/usr/bin/python2,'
}
